package com.elitel.frame.web.cfgsiminfo.controller;

import com.elitel.frame.main.entity.vo.JsonResult;
import com.elitel.frame.web.cfgsiminfo.entity.CfgSimQueryField;
import com.elitel.frame.web.cfgsiminfo.entity.CfgSimQueryFieldListDTO;
import com.elitel.frame.web.cfgsiminfo.service.CfgSimQueryFieldService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author mulis
 */
@RestController
@RequestMapping("/cfgSimQueryField")
public class CfgSimQueryFieldController {
    @Resource
    private CfgSimQueryFieldService cfgSimQueryFieldService;

    @GetMapping("/selectList")
    public JsonResult selectList(CfgSimQueryField cfgSimQueryField) {
        JsonResult jsonResult = new JsonResult();
        jsonResult.setSuccess(true);
        jsonResult.setData(cfgSimQueryFieldService.selectList(cfgSimQueryField));
        return jsonResult;
    }

    @PostMapping("/saveList")
    public JsonResult saveList(@RequestBody CfgSimQueryFieldListDTO dto) {
        JsonResult jsonResult = new JsonResult();
        try {

            jsonResult.setSuccess(true);
            cfgSimQueryFieldService.saveList(dto);
        } catch (Exception e) {
            jsonResult.setSuccess(false);
            jsonResult.setMsg(e.getMessage());
        }
        return jsonResult;
    }


}
